[HVM] Fix the issue that the HVM 64bit guest cannot boot with 32G memory.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 16 Aug 2006 10:58:48 +0000 (11:58 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 16 Aug 2006 10:58:48 +0000 (11:58 +0100)
It enlarges the PGT_mfn_mask to support 27bit, and also remove the
score stuff on x86-64.

Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
Signed-off-by: Xiaohui Xin <xiaohui.xin@intel.com>
xen/arch/x86/shadow.c
xen/arch/x86/shadow_public.c
xen/include/asm-x86/mm.h

index f29985fc0598fab30daff7285d1db0f26d1ef354..88e2ec8417b931597856988396a1fa527ff0c60e 100644 (file)
@@ -1315,55 +1315,6 @@ static int is_out_of_sync(struct vcpu *v, unsigned long va) /* __shadow_out_of_s
     return 0;
 }
 
-#define GPFN_TO_GPTEPAGE(_gpfn) ((_gpfn) / (PAGE_SIZE / sizeof(guest_l1_pgentry_t)))
-static inline unsigned long
-predict_writable_pte_page(struct domain *d, unsigned long gpfn)
-{
-    return __shadow_status(d, GPFN_TO_GPTEPAGE(gpfn), PGT_writable_pred);
-}
-
-static inline void
-increase_writable_pte_prediction(struct domain *d, unsigned long gpfn, unsigned long prediction)
-{
-    unsigned long score = prediction & PGT_score_mask;
-    int create = (score == 0);
-
-    // saturating addition
-    score = (score + (1u << PGT_score_shift)) & PGT_score_mask;
-    score = score ? score : PGT_score_mask;
-
-    prediction = (prediction & PGT_mfn_mask) | score;
-
-    //printk("increase gpfn=%lx pred=%lx create=%d\n", gpfn, prediction, create);
-    set_shadow_status(d, GPFN_TO_GPTEPAGE(gpfn), 0, prediction, PGT_writable_pred, 0);
-
-    if ( create )
-        perfc_incr(writable_pte_predictions);
-}
-
-static inline void
-decrease_writable_pte_prediction(struct domain *d, unsigned long gpfn, unsigned long prediction)
-{
-    unsigned long score = prediction & PGT_score_mask;
-    ASSERT(score);
-
-    // divide score by 2...  We don't like bad predictions.
-    //
-    score = (score >> 1) & PGT_score_mask;
-
-    prediction = (prediction & PGT_mfn_mask) | score;
-
-    //printk("decrease gpfn=%lx pred=%lx score=%lx\n", gpfn, prediction, score);
-
-    if ( score )
-        set_shadow_status(d, GPFN_TO_GPTEPAGE(gpfn), 0, prediction, PGT_writable_pred, 0);
-    else
-    {
-        delete_shadow_status(d, GPFN_TO_GPTEPAGE(gpfn), 0, PGT_writable_pred, 0);
-        perfc_decr(writable_pte_predictions);
-    }
-}
-
 static int fix_entry(
     struct domain *d,
     l1_pgentry_t *pt, u32 *found, int is_l1_shadow, u32 max_refs_to_find)
index c28269887045f5be4ea40d4398e0591ce2b297a9..40aa22e4eaf526217729cc183c908b4acd39b3db 100644 (file)
@@ -749,7 +749,7 @@ void free_shadow_page(unsigned long smfn)
         unsigned long mfn;
         mfn = __shadow_status(d, gpfn, PGT_fl1_shadow);
         if ( !mfn )
-            gpfn |= (1UL << 63);
+            gpfn |= PGT_high_mfn_nx;
     }
 #endif
 #if CONFIG_PAGING_LEVELS >= 3
index dc96970c554d10870954d9698c07150a82041c1d..06ea59875454ff99a3f24036b39a6b3ffbd5f210 100644 (file)
@@ -101,17 +101,17 @@ struct page_info
 #ifdef __x86_64__
 #define PGT_high_mfn_shift  52
 #define PGT_high_mfn_mask   (0xfffUL << PGT_high_mfn_shift)
-#define PGT_mfn_mask        (((1U<<23)-1) | PGT_high_mfn_mask)
+#define PGT_mfn_mask        (((1U<<27)-1) | PGT_high_mfn_mask)
 #define PGT_high_mfn_nx     (0x800UL << PGT_high_mfn_shift)
 #else
  /* 23-bit mfn mask for shadow types: good for up to 32GB RAM. */
 #define PGT_mfn_mask        ((1U<<23)-1)
  /* NX for PAE xen is not supported yet */
 #define PGT_high_mfn_nx     (1ULL << 63)
-#endif
 
 #define PGT_score_shift     23
 #define PGT_score_mask      (((1U<<4)-1)<<PGT_score_shift)
+#endif
 
  /* Cleared when the owning guest 'frees' this page. */
 #define _PGC_allocated      31